<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>
        <ui:composition template="../templates/default3.xhtml">
            <ui:define name="content">
                <h:form id="manageShippingOrders" binding="#{shippingManagerBean.loadManageShippingOrders}">
                    <p:panel header="Shipping Orders" id="shippingOrdersPanel">
                        <p:messages />
                        
                        <p:dataTable id="shippingOrders" var="shippingOrder" value="#{shippingManagerBean.shippingOrders}" selectionMode="single" 
                                     selection="#{shippingManagerBean.selectedShippingOrder}" paginator="true" rows="10"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" >
                            <p:column filterBy="#{shippingOrder.id}" headerText="Shipping Order Id" filterMatchMode="contains">  
                                <h:outputText value="#{shippingOrder.id}" />  
                            </p:column> 
                            <p:column filterBy="#{shippingOrder.deliveryDate}" headerText="Delivery Date" filterMatchMode="contains">  
                                <h:outputText value="#{shippingOrder.deliveryDate}">  
                                    <f:convertDateTime pattern="dd-MM-yyyy" timeZone="#{defaultManagerBean.tz}"/>
                                </h:outputText>
                            </p:column> 
                            <p:column filterBy="#{shippingOrder.purchaseItem.id}" headerText="Purchase Item Id" filterMatchMode="contains">  
                                <h:outputText value="#{shippingOrder.purchaseItem.id}" />  
                            </p:column>
                        </p:dataTable>
                        <table class="table-submit">
                            <tr>
                                <td align="center">
                                    <p:commandButton id="btnAddAShippingOrder" value="Add Shipping Order"
                                                     title="Add a shipping order." ajax="true"
                                                     update="shippingOrdersPanel"
                                                     actionListener="#{shippingManagerBean.addShippingOrder}" />
                                    <p:commandButton id="btnViewShippingOrder" value="View Shipping Order"
                                                     title="View a shipping order." ajax="true"
                                                     update="shippingOrdersPanel"
                                                     actionListener="#{shippingManagerBean.viewShippingOrder}" />
                                </td>
                            </tr>
                        </table>
                    </p:panel>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
